<?php
error_reporting(E_ALL & ~E_NOTICE);
@session_start();

//สร้าง Session เพื่อให้ปุ่มบันทึกลูกหนี้แสดง
if($_SESSION['billstatus']!='2'){
$_SESSION['billstatus'] = "2";
session_write_close();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../function/func.js"></script>
<title>Network Shop Management System</title>
<style type="text/css" >

<!--
body,td,th {
	font-family: Tahoma, Geneva, sans-serif;
	font-size: 14px;
	text-align: center;
}
.ss {
	text-align: right;
}
.bbb {
	font-weight: bold;
}
body {
	background-color: #CCC;
}
-->

</style>

</head>
<body onload="document.frmbill.name.focus();">
<?php
if($_GET["action"]=='namebill') {
	if($_POST["name"]!="" || $_POST["address"]!=""){
	$_SESSION["name_bill2"] = $_POST["name"];
	$_SESSION["address_bill2"] = $_POST["address"];
	session_write_close();
	
	echo "<script>window.location='bill2.php';</script>";
	} else {
	$error = "<font color=red>กรุณากรอกข้อมูลให้ครบ</font>";
	}
}
?>
<form action="?action=namebill" method="post" name="frmbill" id="frmbill">
<table width="400" border="0" align="center" cellpadding="20" cellspacing="1" bgcolor="#666666">
  <tr>
    <td width="400" bgcolor="#FFFFFF"><p><strong>กรุณากรอก ชื่อ-นามสกุล และที่อยู่ ลูกหนี้</strong></p>
      <table width="80%" border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td><div align="right">ชื่อ-นามสกุล : </div></td>
        <td><div align="left">
          <input name="name" type="text" id="name" onkeyup="IsScharacter(this.value,this)" size="25" />
        </div></td>
      </tr>
      <tr>
        <td valign="top"><div align="right">ที่อยู่ : </div></td>
        <td><div align="left">
          <textarea name="address" rows="3" onkeyup="IsScharacter(this.value,this)" id="address"></textarea>
        </div></td>
      </tr>
    </table>    </td>
  </tr>
</table><br />
<?php echo $error; ?>
  <p>
    <script language="javascript">
function printpr()
{
var OLECMDID = 6;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 2; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}
  </script>
    </p>
  <p>
    <input type="submit" name="Submit" id="button" value="แสดงใบแจ้งหนี้" />
  </p>
</form>
</body>
</html>
